#include <bits/stdc++.h>
using namespace std;
const int maxm = 100000;
struct plane {
	int a, b, id;
} p1[maxm + 5], p2[maxm + 5], q1[maxm + 5], q2[maxm + 5];
bool vis1[maxm + 5], vis2[maxm + 5];
bool cmp1(const plane& a, const plane& b) {
	return a.a < b.a;
}
bool cmp2(const plane& a, const plane& b) {
	return a.b < b.b;
}
int main() {
	freopen("airport.in", "r", stdin);
	freopen("airport.out", "w", stdout);
	int n, m1, m2;
	scanf("%d%d%d", &n, &m1, &m2);
	for (int i = 1; i <= m1; i++) {
		scanf("%d%d", &p1[i].a, &p1[i].b);
		p1[i].id = i;
	}
	for (int i = 1; i <= m2; i++) {
		scanf("%d%d", &p2[i].a, &p2[i].b);
		p2[i].id = i;
	}
	copy(p1 + 1, p1 + m1 + 1, q1 + 1);
	copy(p2 + 1, p2 + m2 + 1, q2 + 1);
	sort(p1 + 1, p1 + m1 + 1, cmp1);
	sort(p2 + 1, p2 + m2 + 1, cmp1);
	sort(q1 + 1, q1 + m1 + 1, cmp2);
	sort(q2 + 1, q2 + m2 + 1, cmp2);
	int ans = 0;
	for (int i = 0; i <= n; i++) {
		int cnt = m1 + m2;
		int now = 0;
		memset(vis1, 0, sizeof(vis1));
		for (int j = 1, k = 0; j <= m1; j++) {
			while (q1[k + 1].b < p1[j].a && k < m1) {
				k++;
				if (vis1[q1[k].id])
					now--;
			}
			if (now + 1 <= i) {
				now++;
				vis1[p1[j].id] = true;
			} else
				cnt--;
		}
		now = 0;
		memset(vis2, 0, sizeof(vis2));
		for (int j = 1, k = 0; j <= m2; j++) {
			while (q2[k + 1].b < p2[j].a && k < m2) {
				k++;
				if (vis2[q2[k].id])
					now--;
			}
			if (now + 1 <= n - i) {
				now++;
				vis2[p2[j].id] = true;
			} else
				cnt--;
		}
		ans = max(ans, cnt);
	}
	printf("%d", ans);
}
